package com.example.bookstore.utils;

import org.apache.commons.beanutils.BeanUtils;

import java.lang.reflect.InvocationTargetException;
import java.text.BreakIterator;
import java.util.Map;

public class WebUtils {
    public static<T> T copyParamToBean(Map map,T bean){
        try {
            BeanUtils.populate(bean,map);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return bean;
    }

    public static int parseInt(String StrInt ,int defaultValue){
        try {
            return Integer.parseInt(StrInt);

        } catch (Exception e) {
//            e.printStackTrace();
        }
        return defaultValue;
    }

}
